<?php

/**
 * ECSHOP 商品详情
 * ============================================================================
 * 版权所有 2005-2010 上海商派网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.ecshop.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liuhui $
 * $Id: goods.php 17063 2010-03-25 06:35:46Z liuhui $
*/
define('IN_ECS', true);

//require(dirname(dirname(__FILE__)) . '/includes/init.php');
include_once(dirname(__FILE__) . '/cls_ruitai.php');
$rtuitai=new PartnerCls();

$code=$_POST["txt_code"];
$openid = $_POST['openid'];
// $openid = 'oNH2mjpePhhBVEoep6mWLFnWfyhA';
$cid = $_POST['cid'];
// echo $cid."cid<br/>";
// echo $code."code<br/>";
// echo $openid."openid<br/>";
// $rtuitai->QueryInfo($code);    //测试时临时关闭s
// $amountjf = $rtuitai->getAmount();  //积分值
// $amountjf = 5000;  //假设值
$jfmoney = sprintf("%.2f", $amountjf/100);

// echo $jfmoney;
// echo $amountjf;
// exit;

$seqvalue = $rtuitai->getSeq();

// echo $seqvalue;
// exit;

$time = $rtuitai->getValidtime();  //有效期
$jfexpritime = date('Y-m-d H:i:s', $time);
// $jfexpritime = date('Y-m-d H:i:s',time());    //假设值

$sql = 'SELECT cname from tage_integral_com where cid='.$cid;
$result = $db->getRow($sql);
$cname = $result['cname'];


$sql = "SELECT a.cgid,a.saleprice,a.integralvalue,a.typ,a.boundprice,b.goods_name,b.goods_img,b.goods_thumb FROM `tage_integral_goods` as a ,tage_goods as b where a.goodsid=b.goods_sn and a.integralvalue=$amountjf and a.cid=".$cid;
$result = $db->getAll($sql);

$smarty->assign("seqvalue",$seqvalue);
$smarty->assign("cname",$cname);
$smarty->assign("openid",$openid);
$smarty->assign("code",$code);
$smarty->assign("result",$result);
$smarty->assign("jfmoney",$jfmoney);
$smarty->assign("jfexpritime",$jfexpritime);

$smarty->display("jfgoods.dwt");

?>